<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>

    <script>
            function valueNumber(nmb){
                let reg = /^\d+$/;
                return reg.test(nmb)
            }
        window.onload = function () {
            let btn = document.getElementById("btn");

            btn.onclick = function () {
                let note_1 = document.getElementById("note_1").value;
                let note_2 = document.getElementById("note_2").value;
                let note_3 = document.getElementById("note_3").value;
                let note_4 = document.getElementById("note_4").value;
                let note_5 = document.getElementById("note_5").value;
                let flag1 = valueNumber(note_1);
                let flag2 = valueNumber(note_2);
                let flag3 = valueNumber(note_3);
                let flag4 = valueNumber(note_4);
                let flag5 = valueNumber(note_5);
                if (!(flag1 && flag2 && flag3 && flag4&& flag5 )){
                    alert('输入的不是数字')
                }

                let arr = [note_1, note_2, note_3, note_4, note_5]
                let max = 0;
                let min = 0;
                let avg = 0;
                let sum = 0;
                for (let i = 0; i < arr.length; i++) {
                    //求最大值
                    max = arr[0];
                    if (max < arr[i]) {
                        max = arr[i];
                    }


                }


                for (let i = 0; i < arr.length; i++) {
                    //求最小值
                    min = arr[0];
                    if (min > arr[i]) {
                        min = arr[i]
                    }

                }

                //求和
                for (let i = 0; i < arr.length; i++) {
                    sum += Number(arr[i]);
                }
                //求平均值
                avg = sum / 5;
                console.log(max)
                console.log(min)
                console.log(avg)
                console.log(sum)

                let div = document.getElementById("zhi");
                div.innerHTML = `最大值为：${max} <br>最小值为：${min} <br>平均值为：${avg} <br>和为：${sum} <br>`

            }

        }
    </script>
</head>
<body>
<form action="#">
    <input type="text" id="note_1">
    <input type="text" id="note_2">
    <input type="text" id="note_3">
    <input type="text" id="note_4">
    <input type="text" id="note_5">

    <input type="button" value="计算" id="btn">
</form>

<div id="zhi">

</div>
</body>
</html>